#include <QFile>
#include <QDebug>


int getBatCapacity()
{
	int cap;

	QString sysfile = "/sys/class/power_supply/BAT0/capacity";
	QFile f(sysfile);
	if(f.open(QIODevice::ReadOnly)){
		auto val = f.readAll();
		QString v = QString::fromUtf8(val).trimmed();
		cap = v.toInt();
		// qDebug() << "cap: " << cap;
		f.close();
	}

	return cap;

}
